package com.ltkj.baseplatform.controller;

import com.ltkj.baseplatform.domain.SerGuidedTours;
import com.ltkj.baseplatform.service.ISerGuidedToursService;
import com.ltkj.common.core.utils.poi.ExcelUtil;
import com.ltkj.common.core.web.controller.BaseController;
import com.ltkj.common.core.web.domain.AjaxResult;
import com.ltkj.common.core.web.page.TableDataInfo;
import com.ltkj.common.log.annotation.Log;
import com.ltkj.common.log.enums.BusinessType;
import com.ltkj.common.security.annotation.RequiresPermissions;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 导览信息Controller
 * 
 * @author chenzeen
 * @date 2023-09-08
 */
@Api(tags = "导览信息")
@RestController
@RequestMapping("/tours")
public class SerGuidedToursController extends BaseController
{
    @Autowired
    private ISerGuidedToursService serGuidedToursService;

    /**
     * 查询导览信息列表
     */
    @ApiOperation("查询导览信息列表")
    @GetMapping("/list")
    public TableDataInfo list(SerGuidedTours serGuidedTours)
    {
        startPage();
        List<SerGuidedTours> list = serGuidedToursService.selectSerGuidedToursList(serGuidedTours);
        return getDataTable(list);
    }

    /**
     * 导出导览信息列表
     */
    @ApiOperation("导出导览信息列表")
    @Log(title = "导览信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SerGuidedTours serGuidedTours)
    {
        List<SerGuidedTours> list = serGuidedToursService.selectSerGuidedToursList(serGuidedTours);
        ExcelUtil<SerGuidedTours> util = new ExcelUtil<SerGuidedTours>(SerGuidedTours.class);
        util.exportExcel(response, list, "导览信息数据");
    }

    /**
     * 获取导览信息详细信息
     */
    @ApiOperation("获取导览信息详细信息")
    @GetMapping(value = "/{guideId}")
    public AjaxResult getInfo(@PathVariable("guideId") Long guideId)
    {
        return success(serGuidedToursService.selectSerGuidedToursByGuideId(guideId));
    }

    /**
     * 新增导览信息
     */
    @ApiOperation("新增导览信息")
    @RequiresPermissions("baseplatform:tours:add")
    @Log(title = "导览信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SerGuidedTours serGuidedTours)
    {
        return toAjax(serGuidedToursService.insertSerGuidedTours(serGuidedTours));
    }

    /**
     * 修改导览信息
     */
    @ApiOperation("修改导览信息")
    @RequiresPermissions("baseplatform:tours:edit")
    @Log(title = "导览信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SerGuidedTours serGuidedTours)
    {
        return toAjax(serGuidedToursService.updateSerGuidedTours(serGuidedTours));
    }

    /**
     * 删除导览信息
     */
    @ApiOperation("删除导览信息")
    @RequiresPermissions("baseplatform:tours:remove")
    @Log(title = "导览信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{guideIds}")
    public AjaxResult remove(@PathVariable Long[] guideIds)
    {
        return toAjax(serGuidedToursService.deleteSerGuidedToursByGuideIds(guideIds));
    }
}
